package com.xesj.serviceimpl;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xesj.dao.UserMapper;
import com.xesj.model.Page;
import com.xesj.model.User;
import com.xesj.service.UserServiceI;
import com.xesj.util.PageData;
@Service("userService")
@Transactional
public class UserServiceImpl implements UserServiceI {
	@Autowired
	private UserMapper userDao;
	
	public User selectUserById(PageData pd) {
		
		
		return userDao.selectUserById(pd);
	}

	
	public int registMember(User user) {
		int userInfoId= userDao.insertUserInfo(user);
		user.setRoleId("1");
		user.setUserInfoId(userInfoId+"");
		user.setLoginType("1");
		int count=userDao.insertUser(user);
		return count;
	}


	public ArrayList<User> selectMemberList(Page page) {
		
		return userDao.selectMemberList(page);
	}


	@Override
	public User getByUsername(String loginName) {
		// TODO Auto-generated method stub
		return userDao.getByUsername(loginName);
	}


	@Override
	public List<String> getRolesListByName(String loginName) {
		// TODO Auto-generated method stub
		return userDao.getRolesListByName(loginName);
	}


	@Override
	public List<String> getPermissionsListByName(String loginName) {
		// TODO Auto-generated method stub
		
		return userDao.getPermissionsListByName(loginName);
	}


	@Override
	public int updateMember(PageData pd) {
		// TODO Auto-generated method stub
		return userDao.updateMember(pd);
	}

}
